﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DGPLADES_AdminUsuario.aspx.cs" %>

<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDataView" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script runat="server">
        String giroSeleccionado;
        protected void Page_Load(object sender, EventArgs e)
        {
            //if ((IsPostBack))
            //{
            //    lblUsuario.Text = "SI es PostBack";
            // }
            //else
            //{
            //    lblUsuario.Text = "NO es PostBack";
            //}
        }

        protected void ButtonGuardar_Click(object sender, EventArgs e)
        {
            // Se re-direcciona hacia la pagina principal.
            Session.Contents["ses_intnivel"] = 0;
            Response.Redirect("Default.aspx", false);
        }

        protected void ButtonLimpiar_Click(object sender, EventArgs e)
        {
            // Se re-direcciona hacia la pagina principal.
            Session.Contents["ses_intnivel"] = 0;
            Response.Redirect("Default.aspx", false);
        }

        protected void ButtonAsociar_Click(object sender, EventArgs e)
        {
            // Se re-direcciona hacia la pagina principal.
            Session.Contents["ses_intnivel"] = 0;
            Response.Redirect("Default.aspx", false);
        }

        protected void ButtonAgregar_Click(object sender, EventArgs e)
        {
            // Se re-direcciona hacia la pagina principal.
            Session.Contents["ses_intnivel"] = 0;
            Response.Redirect("Default.aspx", false);
        }
    
        protected void ButtonExcluir_Click(object sender, EventArgs e)
        {
            // Se re-direcciona hacia la pagina principal.
            Session.Contents["ses_intnivel"] = 0;
            Response.Redirect("Default.aspx", false);
        }

        protected void ASPxGridViewUsuarios_SelectionChanged(Object sender, EventArgs e)
        {
            // Se obtienen datos del Usuario seleccionado. 
            string[] strlista = { "id_Usuarios", "Nombre", "Apellidos" , "email"};
            List<Object> row = ASPxGridViewUsuarios.GetSelectedFieldValues(strlista);
        } 
    </script>
    <style type="text/css">
        .style3
        {
            width: 287px;
        }
        .style4
        {
            width: 217px;
        }
        .style5
        {
            width: 389px;
        }
        .style9
        {
            width: 1376px;
        }
        .style10
        {
            height: 32px;
        }
        .style13
        {
            width: 707px;
        }
        .style16
        {
            width: 162px;
        }
        .style18
        {
            width: 308px;
        }
        .style19
        {
            width: 764px;
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table style="width:60%;" width="200">
        <tr valign="top">
            <td class="style9">
               <h2>
                   <asp:Label ID="lblUsuario" runat="server" Text="Usuarios"></asp:Label>
               </h2>
            </td>
            <td colspan="2" class="style5" valign="top">
                <table style="width: 59%; height: 486px;">
                    <tr>
                        <td class="style19">
                            <table style="width:50%;">
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Clave:</td>
                                    <td class="style3">
                                        <asp:TextBox ID="TextBox_IdUsuario"  disabled="true" runat="server" Width="47px"></asp:TextBox>
                                    </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Usuario:</td>
                                    <td class="style3">
                                            <asp:TextBox ID="TextBox_Nombre1"  runat="server" Height="23px" 
                                                Width="145px"></asp:TextBox>                                   
                                        </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Contraseña:</td>
                                    <td class="style3">
                                            <asp:TextBox ID="TextBox_Nombre2"  runat="server" Height="23px" 
                                                Width="145px"></asp:TextBox>                                   
                                        </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Nombre:</td>
                                    <td class="style3">
                                            <asp:TextBox ID="TextBox_Nombre0"   runat="server" Height="23px" 
                                                Width="145px"></asp:TextBox>                                   
                                        </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Apellidos:</td>
                                    <td class="style3">
                                        <asp:TextBox ID="TextBox_Contrasenia" runat="server" Height="22px" 
                                            Width="233px"></asp:TextBox>
                                    </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        Correo</td>
                                    <td class="style3">
                                        
                                        <asp:TextBox ID="TextBox_Contrasenia0" runat="server" Height="22px" 
                                            Width="233px"></asp:TextBox>
                                        
                                    </td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style4">
                                        &nbsp;</td>
                                    <td class="style2">
                                        &nbsp;</td>
                                    <td class="style3">
                                        
                                        &nbsp;</td>
                                    <td class="style18">
                                        &nbsp;</td>
                                </tr>
                            </table>
                        </td>
                        <td class="style13">
                            &nbsp;</td>
                    </tr>
                    <tr>
                       <td class="style19">
                            <dx:ASPxGridView ID="ASPxGridViewUsuarios" runat="server" AutoGenerateColumns="False" 
                                DataSourceID="SqlDataSourceUsuario" onselectedindexchanged="ASPxGridViewUsuarios_SelectionChanged"
                                Width="362px">
                                <%--<ClientSideEvents RowClick="function(s, e) { OnUsuarioRow_Click(e); }"></ClientSideEvents>--%>
                                <%--<ClientSideEvents SelectionChanged="ASPxGridViewUsuarios_SelectionChanged" />--%>
                                <Columns>
                                    <dx:GridViewDataTextColumn FieldName="id_Usuarios" 
                                        VisibleIndex="0">
                                        <EditFormSettings Visible="False" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Username" 
                                        VisibleIndex="1">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Password" 
                                        VisibleIndex="2">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Nombre" VisibleIndex="3">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Apellidos" VisibleIndex="4">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="mail" VisibleIndex="5">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                                <Settings ShowGroupPanel="True" ShowHorizontalScrollBar="True" />
                            </dx:ASPxGridView>
                                                    
                        </td>
                       <td class="style13">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td class="style19">
                            <asp:SqlDataSource ID="SqlDataSourceUsuario" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:DGPLADES_BudConnectionString %>"                    
                                SelectCommand="SELECT Usuarios.* FROM bud.Usuarios ORDER BY Nombre" 
                                
                                ProviderName="<%$ ConnectionStrings:DGPLADES_BudConnectionString.ProviderName %>">
                            </asp:SqlDataSource>
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                </table>
            </td>
            <td class="style5" valign="top">
                                        <asp:Button ID="ButtonGuardar" runat="server" onclick="ButtonGuardar_Click" 
                                            Text="Guardar" Width="62px" />
            &nbsp;<asp:Button ID="ButtonGuardar0" runat="server" onclick="ButtonLimpiar_Click" 
                                            Text="Limpiar" Width="50px" />
            &nbsp;<asp:Button ID="ButtonGuardar1" runat="server" onclick="ButtonAsociar_Click" 
                                            Text="Asociar" Width="53px" />
            </td>
            <td class="style5" valign="top">
                                        &nbsp;</td>
        </tr>
        <tr valign="top">
            <td class="style9" valign="top">
                &nbsp;</td>
            <td class="style5" valign="top">
                            <dx:ASPxGridView ID="ASPxGridViewGrupo0" runat="server" AutoGenerateColumns="False" 
                                DataSourceID="SqlDataSourceGrupo0" 
                                Width="362px">
                                <Columns>
                                    <dx:GridViewDataTextColumn FieldName="id_Grupos" 
                                        VisibleIndex="0">
                                        <EditFormSettings Visible="False" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Nombre" 
                                        VisibleIndex="1">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Descripcion" VisibleIndex="2">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                                <Settings ShowGroupPanel="True" ShowHorizontalScrollBar="True" />
                            </dx:ASPxGridView>                        
                            <asp:SqlDataSource ID="SqlDataSourceGrupo0" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:DGPLADES_BudConnectionString %>"                    
                                SelectCommand="SELECT * FROM  bud.Grupos" 
                                
                    ProviderName="<%$ ConnectionStrings:DGPLADES_BudConnectionString.ProviderName %>">
                            </asp:SqlDataSource>
                        </td>
            <td class="style5" valign="top">
                                        <asp:Button ID="Button_Guardar" runat="server" onclick="ButtonAgregar_Click" 
                                            Text=">" Width="53px" />
                                            <br />
                                             <asp:Button ID="Button_Excluir" runat="server" onclick="ButtonExcluir_Click" 
                                            Text="<" Width="53px" />                                   
                                    </td>
            <td class="style5" valign="top">
                            <dx:ASPxGridView ID="ASPxGridViewGrupo1" runat="server" AutoGenerateColumns="False" 
                                DataSourceID="SqlDataSourceGrupo1" 
                                Width="362px">
                                <Columns>
                                    <dx:GridViewDataTextColumn FieldName="id_Grupos" 
                                        VisibleIndex="0">
                                        <EditFormSettings Visible="False" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Nombre" 
                                        VisibleIndex="1">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="Descripcion" VisibleIndex="2">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                                <Settings ShowGroupPanel="True" ShowHorizontalScrollBar="True" />
                            </dx:ASPxGridView>                        
                            <asp:SqlDataSource ID="SqlDataSourceGrupo1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:DGPLADES_BudConnectionString %>"                    
                                SelectCommand="SELECT * FROM bud.Grupos" 
                                
                    
                    ProviderName="<%$ ConnectionStrings:DGPLADES_BudConnectionString.ProviderName %>">
                            </asp:SqlDataSource>
                        </td>
            <td class="style5" valign="top">
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>
